/**
 * (created at 2011-2-17)
 */
package qiushuo.mysqlparser.ast.statement;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import qiushuo.mysqlparser.ast.expression.Expression;
import qiushuo.mysqlparser.generator.SQLType;
import qiushuo.mysqlparser.util.Pair;

/**
 * @author <a href="mailto:QiuShuo1985@gmail.com">QIU Shuo</a>
 */
public class DALSetStatement implements Statement {
    public static enum KeyType {
        GLOBAL,
        SESSION,
        USER
    }

    /**
     * String: {@link KeyType#USER} then include '@'; otherwise, not include any
     * '@' or "global" and so on
     */
    private final List<Pair<Pair<KeyType, String>, Expression>> assignmentList;

    public DALSetStatement(List<Pair<Pair<KeyType, String>, Expression>> assignmentList) {
        if (assignmentList == null || assignmentList.isEmpty()) {
            this.assignmentList = Collections.emptyList();
        } else if (assignmentList instanceof ArrayList) {
            this.assignmentList = assignmentList;
        } else {
            this.assignmentList = new ArrayList<Pair<Pair<KeyType, String>, Expression>>(assignmentList);
        }
    }

    @Override
    public String generateSql(SQLType type) {
        // QS_TODO gen sql
        throw new UnsupportedOperationException("not implemented yet");
    }
}
